package magic;

import card.EventCard;
import dice.RollDice;
import player.Player;

public class MagicController {
	Player player;
	
	/**
	Player can own 3 magic card only! And player cannot own the same magic card
	escape hospital magic card
	 */
	 
	public MagicController(Player p){
		player = p;
	}
	
	public int pickMagicCard(int diceNo){
		boolean result = true;
		
		if(player.getMagicCard(diceNo-1))
			result = false;
		else{
			player.setMagicCards(diceNo-1, true); /**put the magic card in player */
			result = true;
		}
		
		/**
		if result is true, then return the value to Window 
		to tell that this card is selected and the player does not own it before
		 */
		if(result)
			return diceNo; 
		else
			return 0;
	}
	
	public int RandomCards(){
		EventCard eventCards = new EventCard();
		RollDice rd = new RollDice(); /**Random Event*/
		int result = rd.roll2(eventCards.getEventArrLength());
		return result;
	}
}

